/**
 * @file   main.cpp
 * @author WinterMelonCDY <wintermeloncdy@wintermeloncdy-VirtualBox>
 * @date   Thu Oct  7 17:22:13 2021
 * 
 * @brief  
 * 
 * 
 */
#include"Matrix.h"
#include<iostream>
#include<limits>

int main(int argc, char* argv[])
{

    //input number of matrix elements
    int M,N;
    std::cin >> M;
    std::cin >> N;
    Matrix<double> X1(M,N);
    double Input1[M*N];
    for (int i = 0; i < M; i++)
       for(int j = 0; j < N; j++)
            std::cin >> Input1[i*N+j];
    X1.Inputdata(Input1,M,N);
    std::cout << "The first test matrix : " <<std::endl; 
    X1.log();
    std::cout <<(bool)X1.is_square() << std::endl;

    //input number of matrix elements
    std::cin >> M;
    std::cin >> N;
    Matrix<double> X2(M,N);
    double Input2[M*N];
    for (int i = 0; i < M; i++)
       for(int j = 0; j < N; j++)
            std::cin >> Input2[i*N+j];
    X2.Inputdata(Input2,M,N);
    std::cout << "The second test matrix : " <<std::endl; 
    X2.log();
    std::cout <<(bool)X2.is_square() << std::endl;

    auto Y = X1*X2;
    std::cout << "The product of two matrix : " <<std::endl; 
    Y.log();

    int m;
    std::cin >> m;
    RowVector<double> x(m);
    ColVector<double> y(m);
    double input1[m];
    for (int i = 0; i < m; i++)
        std::cin >> input1[i];
    x.Inputdata(input1,m);
    double input2[m];
    for (int i = 0; i < m; i++)
        std::cin >> input2[i];
    y.Inputdata(input2,m);
    std::cout << "The row vector : ";
    x.log();
    std::cout << "The column vector : "<<std::endl;
    y.log();
    auto z1 = y*x;
    std::cout << "The answer of  column vector * row vector is : "<<std::endl;
    z1.log();
    
    auto z2 = x*y;
    std::cout << " The answer of row vector * column vector is: " << z2 <<std::endl;
    auto z3 = x*x;
    std::cout << " The answer of row vector * row vector is: " << z3 <<std::endl;
    auto z4 = y*y;
    std::cout << " The answer of column vector * column vector is: " <<z4 <<std::endl;

    return 0;
}
